<meta charset="utf-8"/>
<input id="num" />
<button onclick="f()">首字母大写</button>
<script>
function f(){
  var str="";
  str=num.value[0].toUpperCase();
  for(var i=1;i<num.value.length;i++){
  var s=num.value[i];
  str=str+s;
  }
  document.write(str);
}
</script>